﻿<div class="container-fluid">
    <div class="row-fluid">
        <div class="span12">
            <div class="widget-box">
                <div class="widget-title">
                    <span class="icon"><i class="icon-cog"></i></span>
                    <h5>
                        页面发布</h5>
                </div>
                <div class="alert alert-success" style="display: none">
                    <a class="close" data-dismiss="alert" href="#">×</a>
                    <h4 class="alert-heading">
                        发布成功!</h4>
                    页面已经成功发布.
                </div>
                <div class="alert alert-error" style="display: none">
                    <a class="close" data-dismiss="alert" href="#">×</a>
                    <h4 class="alert-heading">
                        发布失败!</h4>
                    发布失败或出错，请稍后重试.
                </div>
                <div class="widget-content">
                    <div id="divProcess" class="error_ex">
                        <h3>
                            发布中...</h3>
                        <p>
                            发布页面需要一些时间，请耐心等待.</p>
                        <div class="progress progress-striped active">
                            <div class="bar" style="width: 100%;">
                            </div>
                        </div>
                    </div>
                    <div id="divOk" class="error_ex" style="display: none">
                        <h3>
                            发布完成</h3>
                        <p>
                            页面已经发布完成，请点击下载发布包.</p>
                        <div class="progress progress-striped progress-success">
                            <div class="bar" style="width: 100%;">
                            </div>
                        </div>
@*                        <a class="btn btn-info btn-big" target="_blank" href="@Url.Content(string.Format("~/Preview/{0}", Config.HomePage.TrimStart('/')))">
                            预览</a> *@
                        <a id="btnDownload" class="btn btn-success btn-big" target="_blank" href="####">
                                下载</a>
                    </div>
                    <div id="divError" class="error_ex" style="display: none">
                        <h3>
                            发布完成</h3>
                        <p>
                            没有需要发布的页面或发布过程中出错，请稍后重试.</p>
                        <div class="progress progress-striped progress-danger">
                            <div class="bar" style="width: 100%;">
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<script type="text/javascript">
    $(function () {

        $.post('@Url.Action(ViewBag.Type)', function (result) {
            $("#divProcess").hide();
            if (result !== "Error" && result !== "No") {
                $(".alert-success").show();
                $("#divOk").show();
                $("#btnDownload").attr("href", result);
            } else {
                $(".alert-error").show();
                $("#divError").show();
            }
        });

    });
</script>
